package com.emm.yixun.website.controller.marketing;

//框架包
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.emm.yixun.common.model.*;
import com.emm.yixun.common.model.dto.*;
import com.emm.yixun.common.model.enums.*;
import com.emm.yixun.common.utils.DateUtils;
import com.emm.yixun.customer.service.*;
import com.emm.yixun.estate.service.ProjectPmoServiceFacade;
import com.emm.yixun.estate.service.ProjectPremisesServiceFacade;
import com.emm.yixun.marketing.service.*;
import com.emm.yixun.website.common.utils.NumberToCN;
import com.emm.yixun.website.service.marketing.HaveAdvanceRefundService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.emm.yixun.common.page.Page;
import com.emm.yixun.common.page.PageUtil;
import com.emm.yixun.common.response.Response;
import com.emm.yixun.common.response.ResponseList;
import com.emm.yixun.estate.service.ProjectRoomServiceFacade;
import com.emm.yixun.system.service.MerchantServiceFacade;
import com.emm.yixun.system.service.RoleServiceFacade;
import com.emm.yixun.system.service.UserServiceFacade;
import com.emm.yixun.website.common.ajax.AjaxRes;
import com.emm.yixun.website.common.utils.base.Const;
import com.emm.yixun.website.common.utils.security.ShiroUtil;
import com.emm.yixun.website.controller.base.BaseController;
import com.emm.yixun.website.service.marketing.HaveReceiveRefundService;
//common
//website
//变化的引用
import com.emm.yixun.website.service.marketing.NeedReceicerefundExportService;
import com.emm.yixun.website.utils.ExcelUtil;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/marketing/haveReceiveRefund/")
public class HaveReceiveRefundController extends BaseController<HaveReceiveRefund> {

	@Autowired
	private HaveReceiveRefundServiceFacade haveReceiveRefundServiceFacade;
	@Autowired
	private NeedReceiveRefundServiceFacade needReceiveRefundServiceFacade;
	@Autowired
	private NeedAdvanceRefundServiceFacade needAdvanceRefundServiceFacade;
	@Autowired
	private HaveAdvanceRefundServiceFacade haveAdvanceRefundServiceFacade;
	@Autowired
	private SignedServiceFacade signedServiceFacade;
	@Autowired
	private ReserveAreaServiceFacade reserveAreaServiceFacade;
	@Autowired
	private PayDepositServiceFacade payDepositServiceFacade;
	@Autowired
	private SubscribeServiceFacade subscribeServiceFacade;
	@Autowired
	private UserServiceFacade userServiceFacade;
	@Autowired
	private CustomerServiceFacade customerServiceFacade;
	@Autowired
	private HaveReceiveRefundService haveReceiveRefundService;
	@Autowired
	private HaveAdvanceRefundService haveAdvanceRefundService;
	@Autowired
	private ProjectRoomServiceFacade projectRoomServiceFacade;
	@Autowired
	private MerchantServiceFacade merchantServiceFacade;
	@Autowired
	private MortgageRecordServiceFacade mortgageRecordServiceFacade;
	@Autowired
	private RoleServiceFacade roleServiceFacade;
	@Autowired
	private NeedReceicerefundExportService needReceicerefundExportService;
	@Autowired
	private FamilyMemberServiceFacade familyMemberServiceFacade;
	@Autowired
	private ProjectPmoServiceFacade projectPmoServiceFacade;

	@Autowired
	private ProjectPremisesServiceFacade projectPremisesServiceFacade;

	@RequestMapping(value = "index")
	public String index(ModelMap map) {
		if (doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "fin:needReceive:checkList")) {
			User user = ShiroUtil.getCurrentUser();
			// 认筹开关,默认未关闭(false) ,true已关闭
			boolean payDepositOff = false;
			Response<Boolean> response = merchantServiceFacade.merPayDepositOff(user.getMerchantId());
			if (response.isSuccess()) {
				payDepositOff = response.getEntity();
			}
			// 查询菜单按钮权限
			map.put("permitBtn", getPermissionBtnArray());
			map.put("payDepositOff", payDepositOff);
			return "/marketing/haveReceiveRefund/list";
		}
		return Const.NO_AUTHORIZED_URL;
	}

	// 新增返回实体对象
	@RequestMapping(value = "add", method = RequestMethod.POST)
	@ResponseBody
	public AjaxRes add(HaveReceiveRefundDto dto) {
		AjaxRes ar = getAjaxRes();

		/*
		 * 1.判断权限2.调用新增接口3.返回信息
		 */
		if (ar.setNoAuth(doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "marketing:haveReceiveRefund:add"))) {
			try {
				User user = ShiroUtil.getCurrentUser();
				dto.setMerchantId(user.getMerchantId());
				dto.setCreateUserId(user.getId());
				dto.setDelFlag("0");
				dto.setUpdateUserId(user.getId());
				dto.setUpdateTime(new Date());
				Response<HaveReceiveRefundDto> response = haveReceiveRefundServiceFacade.save(dto);
				if (response.isSuccess()) {
					ar.setSucceedMsg(Const.SAVE_SUCCEED);
				} else {
					ar.setFailMsg(Const.SAVE_FAIL);
				}
			} catch (Exception e) {
				logger.error(e.toString(), e);
				ar.setFailMsg(Const.SAVE_FAIL);
			}
		}
		return ar;
	}

	// 新增返回实体对象
	@RequestMapping(value = "addRefund")
	@ResponseBody
	public boolean addRefund(HttpServletRequest request, HaveReceiveRefundDto dto) {
		boolean flag = false;
		/*
		 * 1.判断权限2.调用新增接口3.返回信息
		 */
		if (doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "fin:haveReceive:refund")) {
			try {
				HaveReceiveRefundDto entity = new HaveReceiveRefundDto();

				String id = request.getParameter("refundId");
				if (StringUtils.isBlank(id)) {
					return flag;
				}
				// 标识是待退款提交还是已收款提交 need == 待退款 ，have == 已收款
				String needOrHave = request.getParameter("needOrHave");
				if ("have".equals(needOrHave)) {
					Response<HaveReceiveRefund> resp = haveReceiveRefundServiceFacade.findById(Long.parseLong(id));
					if (resp.getEntity() == null) {
						return flag;
					}
					BeanUtils.copyProperties(resp.getEntity(), entity);
					entity.setHaveReceiveId(resp.getEntity().getId());
					entity.setOpSource("1");
				} else if ("need".equals(needOrHave)) {
					Response<NeedReceiveRefund> resp = needReceiveRefundServiceFacade.findById(Long.parseLong(id));
					if (resp.getEntity() == null) {
						return flag;
					}
					BeanUtils.copyProperties(resp.getEntity(), entity);
					entity.setReceivablesType(resp.getEntity().getBusinessType()); // 业务类型
					entity.setRelationId(resp.getEntity().getRelationId());// 业务ID
					entity.setReceivablesId(resp.getEntity().getId()); // 应收款ID
					entity.setDeductibleAmount(new BigDecimal("0")); // 抵扣金额
					entity.setTransferStatus("0"); // 转账状态 0 正常 1 已转账
					entity.setOpSource("0");
				} else {
					return flag;
				}

				entity.setBankAccount(dto.getBankAccount()); // 银行账号
				entity.setStatementId(dto.getStatementId()); // 结算人员
				entity.setStatementType(dto.getStatementType()); // 结算类型
				entity.setRefundRemark(dto.getRefundRemark()); // 退款摘要
				entity.setDocType("1"); // 已退款
				entity.setReChecked("0"); // 未复核
				// 结算日期
				String date = request.getParameter("date");
				if (StringUtils.isNotBlank(date)) {
					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
					entity.setStatementDate(sdf.parse(date));
				}
				String counterFee = request.getParameter("counterFee");
				if (StringUtils.isBlank(counterFee)) {
					counterFee = "0";
				}

				entity.setDocTypeName("退款单");
				if(!BusinessTypeEnum.DEPOSIT.getNo().equals(entity.getReceivablesType())) {
					entity.setBusinessTypeName("交易");
				}else{
					entity.setBusinessTypeName("预约单");
				}
				if(HousingFundTypeEnum.FUNDTYPE_45.getNo().equals(entity.getHousingFundType())
						||HousingFundTypeEnum.FUNDTYPE_1.getNo().equals(entity.getHousingFundType())) {
					entity.setGrayType("其它");
				}else if (HousingFundTypeEnum.FUNDTYPE_7.getNo().equals(entity.getHousingFundType())
						|| HousingFundTypeEnum.FUNDTYPE_11.getNo().equals(entity.getHousingFundType())
						|| HousingFundTypeEnum.FUNDTYPE_18.getNo().equals(entity.getHousingFundType())
						|| HousingFundTypeEnum.FUNDTYPE_19.getNo().equals(entity.getHousingFundType())
						|| HousingFundTypeEnum.FUNDTYPE_28.getNo().equals(entity.getHousingFundType())
						|| HousingFundTypeEnum.FUNDTYPE_36.getNo().equals(entity.getHousingFundType())
						|| HousingFundTypeEnum.FUNDTYPE_37.getNo().equals(entity.getHousingFundType())) {
					entity.setGrayType("贷款类房款");
				}else {
					entity.setGrayType("非贷款类房款");
				}
				entity.setGratName(HousingFundTypeEnum.getByNo(entity.getHousingFundType()).getDes());

				boolean flag1 = haveReceiveRefundService.addRefund(entity, Long.parseLong(id), new BigDecimal(
						counterFee), dto.getRealAmount(), needOrHave);
				if (flag1) {
					return true;
				} else {
					return flag;
				}
			} catch (Exception e) {
				logger.error(e.toString(), e);
			}
		}
		return flag;
	}

	/**
	 * 保存垫付首期退款
	 * @param request
	 * @param dto
	 * @return
	 */
	@RequestMapping(value = "addAdvanceRefund")
	@ResponseBody
	public boolean addAdvanceRefund(HttpServletRequest request, HaveAdvanceRefundDto dto) {
		boolean flag = false;
		/*
		 * 1.判断权限2.调用新增接口3.返回信息
		 */
		if (doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "fin:haveReceive:refund")) {
			try {
				HaveAdvanceRefundDto entity = new HaveAdvanceRefundDto();

				String id = request.getParameter("refundId");
				if (StringUtils.isBlank(id)) {
					return flag;
				}
				// 标识是待退款提交还是已收款提交 need == 待退款 ，have == 已收款
				String needOrHave = request.getParameter("needOrHave");
				if ("have".equals(needOrHave)) {
					Response<HaveAdvanceRefund> resp = haveAdvanceRefundServiceFacade.findById(Long.parseLong(id));
					if (resp.getEntity() == null) {
						return flag;
					}
					BeanUtils.copyProperties(resp.getEntity(), entity);
					entity.setHaveReceiveId(resp.getEntity().getId());
					entity.setOpSource("1");
				} else if ("need".equals(needOrHave)) {
					Response<NeedAdvanceRefund> resp = needAdvanceRefundServiceFacade.findById(Long.parseLong(id));
					if (resp.getEntity() == null) {
						return flag;
					}
					BeanUtils.copyProperties(resp.getEntity(), entity);
					entity.setReceivablesType(resp.getEntity().getBusinessType()); // 业务类型
					entity.setRelationId(resp.getEntity().getRelationId());// 业务ID
					entity.setReceivablesId(resp.getEntity().getId()); // 应收款ID
					entity.setDeductibleAmount(new BigDecimal("0")); // 抵扣金额
					entity.setTransferStatus("0"); // 转账状态 0 正常 1 已转账
					entity.setOpSource("0");
				} else {
					return flag;
				}

				entity.setBankAccount(dto.getBankAccount()); // 银行账号
				entity.setStatementId(dto.getStatementId()); // 结算人员
				entity.setStatementType(dto.getStatementType()); // 结算类型
				entity.setRefundRemark(dto.getRefundRemark()); // 退款摘要
				entity.setDocType("1"); // 已退款
				entity.setReChecked("0"); // 未复核
				// 结算日期
				String date = request.getParameter("date");
				if (StringUtils.isNotBlank(date)) {
					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
					entity.setStatementDate(sdf.parse(date));
				}
				String counterFee = request.getParameter("counterFee");
				if (StringUtils.isBlank(counterFee)) {
					counterFee = "0";
				}

				entity.setDocTypeName("退款单");
				if(!BusinessTypeEnum.DEPOSIT.getNo().equals(entity.getReceivablesType())) {
					entity.setBusinessTypeName("交易");
				}else{
					entity.setBusinessTypeName("预约单");
				}
				if(HousingFundTypeEnum.FUNDTYPE_45.getNo().equals(entity.getHousingFundType())
						||HousingFundTypeEnum.FUNDTYPE_1.getNo().equals(entity.getHousingFundType())) {
					entity.setGrayType("其它");
				}else if (HousingFundTypeEnum.FUNDTYPE_7.getNo().equals(entity.getHousingFundType())
						|| HousingFundTypeEnum.FUNDTYPE_11.getNo().equals(entity.getHousingFundType())
						|| HousingFundTypeEnum.FUNDTYPE_18.getNo().equals(entity.getHousingFundType())
						|| HousingFundTypeEnum.FUNDTYPE_19.getNo().equals(entity.getHousingFundType())
						|| HousingFundTypeEnum.FUNDTYPE_28.getNo().equals(entity.getHousingFundType())
						|| HousingFundTypeEnum.FUNDTYPE_36.getNo().equals(entity.getHousingFundType())
						|| HousingFundTypeEnum.FUNDTYPE_37.getNo().equals(entity.getHousingFundType())) {
					entity.setGrayType("贷款类房款");
				}else {
					entity.setGrayType("非贷款类房款");
				}
				entity.setGratName(HousingFundTypeEnum.getByNo(entity.getHousingFundType()).getDes());

				boolean flag1 = haveAdvanceRefundService.addRefund(entity, Long.parseLong(id), new BigDecimal(
						counterFee), dto.getRealAmount(), needOrHave);
				if (flag1) {
					return true;
				} else {
					return flag;
				}
			} catch (Exception e) {
				logger.error(e.toString(), e);
			}
		}
		return flag;
	}

	// 换票
	@RequestMapping(value = "view")
	public String view(Long id, Model model) {
		/*
		 * 1.判断权限2.调用查看接口3.返回信息
		 */
		if (doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "fin:haveReceive:forTickets")) {
			try {
				Response<HaveReceiveRefund> response = haveReceiveRefundServiceFacade.findById(id);
				if (response.isSuccess()) {
					model.addAttribute("model", response.getEntity());
				}
			} catch (Exception e) {
				logger.error(e.toString(), e);
			}
		}
		return "/marketing/haveReceiveRefund/tickets";
	}

	// 复核
	@RequestMapping(value = "re_checked_view")
	public String re_checked_view(Long id, Model model) {
		/*
		 * 1.判断权限2.调用查看接口3.返回信息
		 */
		if (doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "fin:needReceive:check")) {
			try {
				Response<HaveReceiveRefundInfo> response = haveReceiveRefundServiceFacade.findInfoById(id);
				if (response.isSuccess()) {
					HaveReceiveRefundInfo info = response.getEntity();
					if (StringUtils.isNotBlank(info.getHousingFundType())) {
						// 房款类型
						info.setRelationType(HousingFundTypeEnum.getByNo(info.getHousingFundType()).getDes());
					}
					if (StringUtils.isNotBlank(info.getBusinessFlag())) {
						// 业务标志
						info.setBusinessType(BusinessFlagEnum.getByNo(info.getBusinessFlag()).getDes());
					}
					/*
					 * if(StringUtils.isNotBlank(info.getPaymentMethod())){ //结算方式
					 * info.setPaymentMethod_name(PaymentMethodEnum.getByNo (info.getPaymentMethod()).getDes()); }
					 */
					if (StringUtils.isNotBlank(info.getNewBillCode())) {
						// 当新票据号码不为空时，取新票据号码
						info.setBillCode(info.getNewBillCode());
					}
					if (info.getStatementType() != null) {
						info.setPaymentMethod_name(StatementTypeEnum.getByNo(info.getStatementType() + "").getDes());
					}
					model.addAttribute("model", info);
				}
			} catch (Exception e) {
				logger.error(e.toString(), e);
			}
		}
		return "/marketing/haveReceiveRefund/re_checked";
	}

	// 退款
	@RequestMapping(value = "refund_view")
	public String refund_view(Long id, Model model) {
		/*
		 * 1.判断权限2.调用查看接口3.返回信息
		 */
		if (doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "fin:haveReceive:refund")) {
			try {
				Response<HaveReceiveRefundInfo> response = haveReceiveRefundServiceFacade.findInfoById(id);
				if (response.isSuccess()) {
					HaveReceiveRefundInfo info = response.getEntity();
					if (info.getStatementType() != null) {
						info.setPaymentMethod_name(StatementTypeEnum.getByNo(info.getStatementType() + "").getDes());
					}
					if (info.getRelationId() != null) {
						if (info.getReceivablesType().equals(BusinessTypeEnum.DEPOSIT.getNo())) {
							// 认筹
							Response<PayDeposit> resp = payDepositServiceFacade.findById(info.getRelationId());
							if (resp.isSuccess() && resp.getEntity() != null) {
								info.setRelation("认筹");
								info.setRelationCode(resp.getEntity().getDepositCode());
								// info.setCalculatArea(resp.getEntity().getCalculateArea().toString());
								// info.setPrice(resp.getEntity().getPayDepositAmount().toString());
							}
						} else if (info.getReceivablesType().equals(BusinessTypeEnum.SUBSCRIBE.getNo())) {
							// 认购
							Response<SubscribeInfo> resp = subscribeServiceFacade.findByIdInfo(info.getRelationId());
							if (resp.isSuccess() && resp.getEntity() != null) {
								info.setRelation("认购");
								info.setRelationCode(resp.getEntity().getSubscribeCode());
								// info.setCalculatArea(resp.getEntity().getCalculateArea().toString());
								// info.setPrice(resp.getEntity().getDepositReceivable().toString());
								if (resp.getEntity() != null) {
									info.setAgent_name(resp.getEntity().getUserName());
								}
							}
						} else if (info.getReceivablesType().equals(BusinessTypeEnum.SIGNED.getNo())) {
							// 查询签约信息
							Response<SignedInfo> resp = signedServiceFacade.findByIdInfo(info.getRelationId());
							if (resp.isSuccess() && resp.getEntity() != null) {
								info.setRelation("签约");
								info.setRelationCode(resp.getEntity().getSignCode());
								info.setCalculatArea(resp.getEntity().getCalculateArea().toString());
								info.setPrice(resp.getEntity().getSignPrice());
								info.setTotalPrice(resp.getEntity().getSignAmount());
								info.setRelationDate(resp.getEntity().getDidTime());
								if (resp.getEntity() != null) {
									info.setAgent_name(resp.getEntity().getUserName());
								}
							}
						} else if (info.getBusinessType().equals(BusinessTypeEnum.AREA.getNo())) {
							// 面积补差
							Response<ReserveArea> res = reserveAreaServiceFacade.findById(info.getRelationId());
							if (res.isSuccess() && res.getEntity() != null) {
								info.setRelation("面积补差");
								info.setRelationCode(res.getEntity().getId() + "");
								// 签约信息
								Response<Signed> resp = signedServiceFacade.findById(info.getRelationId());
								if (resp.isSuccess() && resp.getEntity() != null) {
									info.setCalculatArea(resp.getEntity().getCalculateArea().toString());
									info.setPrice(resp.getEntity().getSignPrice());
									info.setTotalPrice(resp.getEntity().getSignAmount());
									info.setRelationDate(resp.getEntity().getDidTime());
									if (resp.getEntity().getAgentId() != null) {
										Response<User> resUser = userServiceFacade.findById(resp.getEntity()
												.getAgentId());
										info.setAgent_name(resUser.getEntity().getUserName());
									}
								}
							}
						}
					}
					User user = ShiroUtil.getCurrentUser();
					model.addAttribute("userId", user.getId());
					model.addAttribute("model", info);
					model.addAttribute("needOrHave", "have");
				}
			} catch (Exception e) {
				logger.error(e.toString(), e);
			}
		}
		return "/marketing/haveReceiveRefund/refund";
	}

	/**
	 * 垫付首期退款
 	 */
	@RequestMapping(value = "advanceRefund")
	public String advanceRefund(Long id, Model model) {
		/*
		 * 1.判断权限2.调用查看接口3.返回信息
		 */
		if (doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "fin:haveReceive:refund")) {
			try {
				Response<HaveAdvanceRefundInfo> response = haveAdvanceRefundServiceFacade.findInfoById(id);
				if (response.isSuccess()) {
					HaveAdvanceRefundInfo info = response.getEntity();
					if (info.getStatementType() != null) {
						info.setPaymentMethod_name(StatementTypeEnum.getByNo(info.getStatementType() + "").getDes());
					}
					if (info.getRelationId() != null) {
						if (info.getReceivablesType().equals(BusinessTypeEnum.SIGNED.getNo())) {
							// 查询签约信息
							Response<SignedInfo> resp = signedServiceFacade.findByIdInfo(info.getRelationId());
							if (resp.isSuccess() && resp.getEntity() != null) {
								info.setRelation("签约");
								info.setRelationCode(resp.getEntity().getSignCode());
								info.setCalculatArea(resp.getEntity().getCalculateArea().toString());
								info.setPrice(resp.getEntity().getSignPrice());
								info.setTotalPrice(resp.getEntity().getSignAmount());
								info.setRelationDate(resp.getEntity().getDidTime());
								if (resp.getEntity() != null) {
									info.setAgent_name(resp.getEntity().getUserName());
								}
							}
						}
					}
					User user = ShiroUtil.getCurrentUser();
					model.addAttribute("userId", user.getId());
					model.addAttribute("model", info);
					model.addAttribute("needOrHave", "have");
				}
			} catch (Exception e) {
				logger.error(e.toString(), e);
			}
		}
		return "/marketing/haveReceiveRefund/advanceRefund";
	}

	// 冲销和复核
	@RequestMapping(value = "edit")
	@ResponseBody
	public boolean edit(HttpServletRequest request, String checkedFlag, HaveReceiveRefundDto dto) {
		/*
		 * checkedFlag 1复核 2冲销
		 */
		if (StringUtils.isBlank(checkedFlag)) {
			checkedFlag = "2";
		}
		if (doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "fin:haveReceive:writeOff")) {
			try {
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
				// 更换票据号码日期
				String date = request.getParameter("date");
				if (StringUtils.isNotBlank(date)) {

					dto.setBillDate(sdf.parse(date));
				}
				// 结算日期
				String cdate = request.getParameter("cdate");
				if (StringUtils.isNotBlank(cdate)) {
					dto.setCheckDate(sdf.parse(cdate));
				}
				String result = request.getParameter("result");
				if ("1".equals(result)) {
					User user = ShiroUtil.getCurrentUser();
					dto.setCheckUserId(user.getId());
				}
				// 处理应收款记录，当应收款>已收款，则回复应收款记录继续
				Response<HaveReceiveRefund> hrResponse = haveReceiveRefundServiceFacade.findById(dto.getId());
				Response<Integer> response = haveReceiveRefundServiceFacade.updateByPrimaryKey(dto, true);
				if (response.isSuccess()) {
					if (hrResponse.isSuccess()) {
						if (checkedFlag.equals("2")) {
							String opSource = hrResponse.getEntity().getOpSource();
							if (StringUtils.isNotBlank(opSource) && opSource.equals("1")) {
								// 已收款退款,做冲销操作 ，已收金额=原已收金额+冲销金额，原记录更新为未删除
								Long haveReceiveId = hrResponse.getEntity().getHaveReceiveId();
								if (null != haveReceiveId) {
									Response<HaveReceiveRefund> hrrRespose = haveReceiveRefundServiceFacade
											.findById(haveReceiveId);
									HaveReceiveRefundDto edit = new HaveReceiveRefundDto();
									edit.setId(haveReceiveId);
									// 已收金额=原已收金额+冲销金额
									edit.setRealAmount(hrrRespose.getEntity().getRealAmount()
											.add(hrResponse.getEntity().getRealAmount()));
									edit.setDelFlag("0");
									haveReceiveRefundServiceFacade.updateByPrimaryKey(edit, true);
								}

							}
						}

						Long receivablesId = hrResponse.getEntity().getReceivablesId();
						// 未收金额
						Response<NeedReceiveRefund> nrResponse = needReceiveRefundServiceFacade.findById(receivablesId);
						// 已收金额
						Response<BigDecimal> hraResponse = haveReceiveRefundServiceFacade.findHaveAmount(receivablesId);
						if (checkedFlag.equals("2")) {
							if (nrResponse.isSuccess()
									&& hraResponse.isSuccess()
									&& nrResponse.getEntity().getTotalReceivablesAmount()
											.compareTo(hraResponse.getEntity()) > 0) {
								// 更新应收款记录为未删除
								NeedReceiveRefundDto edit = new NeedReceiveRefundDto();
								edit.setId(nrResponse.getEntity().getId());
								edit.setDelFlag("0");
								edit.setStatus("1");
								needReceiveRefundServiceFacade.updateByPrimaryKey(edit, true);
							}
						}
						// 查询应收款的已收款记录,处理按揭复核状态
						if (checkedFlag.equals("1")) {
							HaveReceiveRefundDto queryHRRD = new HaveReceiveRefundDto();
							queryHRRD.setReceivablesId(hrResponse.getEntity().getReceivablesId());
							ResponseList<HaveReceiveRefund> hrrListResponse = haveReceiveRefundServiceFacade
									.findByDto(queryHRRD);
							if (hrrListResponse.isSuccess() && null != hrrListResponse.getEntity()) {
								int totalCheckCount = hrrListResponse.getEntity().size();
								// 复核通过次数
								int checkPassCount = 0;
								// 复核未通过次数
								int checkNoPassCount = 0;
								for (HaveReceiveRefund hrr : hrrListResponse.getEntity()) {
									// 0 未复核 1 已复核
									String reCheck = hrr.getReChecked();
									if (reCheck.equals("0")) {
										checkNoPassCount++;
									} else if (reCheck.equals("1")) {
										checkPassCount++;
									}
								}
								// 资金复核状态 0未复核 1复核通过 2复核未通过
								String mortgageCheckStatus = "0";
								if (checkPassCount == totalCheckCount) {
									// 复核通过
									mortgageCheckStatus = "1";
								} else if (checkNoPassCount > 0) {
									// 复核未通过
									mortgageCheckStatus = "2";
								}
								MortgageRecordDto entity = new MortgageRecordDto();
								entity.setNeedId(nrResponse.getEntity().getId());
								ResponseList<MortgageRecord> rlMrList = mortgageRecordServiceFacade.findByDto(entity);
								if (rlMrList.isSuccess() && null != rlMrList.getEntity()
										&& rlMrList.getEntity().size() > 0) {
									List<MortgageRecord> mortgageRecords = rlMrList.getEntity();
									for (MortgageRecord mortgageRecord : mortgageRecords) {
										MortgageRecordDto updateDto = new MortgageRecordDto();
										updateDto.setId(mortgageRecord.getId());
										updateDto.setMortgageCheckStatus(mortgageCheckStatus);
										mortgageRecordServiceFacade.updateByPrimaryKey(updateDto, true);
									}
								}
							}
						} else if (checkedFlag.equals("2")) {
							// 更新按揭收款状态
							if (nrResponse.isSuccess() && hraResponse.isSuccess()) {
								// 查询应收款对应的按揭记录
								MortgageRecordDto entity = new MortgageRecordDto();
								entity.setNeedId(nrResponse.getEntity().getId());
								ResponseList<MortgageRecord> rlMrList = mortgageRecordServiceFacade.findByDto(entity);
								// 当存在按揭记录才去更新
								if (rlMrList.isSuccess() && null != rlMrList.getEntity()
										&& rlMrList.getEntity().size() > 0) {
									List<MortgageRecord> mortgageRecords = rlMrList.getEntity();
									// 应收金额
									BigDecimal totalReceivablesAmount = nrResponse.getEntity()
											.getTotalReceivablesAmount();
									// 已收金额
									BigDecimal haveAmount = hraResponse.getEntity();

									if (haveAmount.compareTo(BigDecimal.ZERO) <= 0) {
										// 当已收款金额小于等于0时更新按揭收款状态为未收款
										for (MortgageRecord mortgageRecord : mortgageRecords) {
											MortgageRecordDto updateDto = new MortgageRecordDto();
											updateDto.setId(mortgageRecord.getId());
											updateDto.setMortgageReceivedStatus("0");// 已收款
											mortgageRecordServiceFacade.updateByPrimaryKey(updateDto, true);
										}
									} else if (haveAmount.compareTo(BigDecimal.ZERO) > 0
											&& haveAmount.compareTo(totalReceivablesAmount) < 0) {
										// 当已收款金额大于0而且小于应收款金额时更新按揭收款状态为部分付款
										for (MortgageRecord mortgageRecord : mortgageRecords) {
											MortgageRecordDto updateDto = new MortgageRecordDto();
											updateDto.setId(mortgageRecord.getId());
											updateDto.setMortgageReceivedStatus("1");// 已收款
											mortgageRecordServiceFacade.updateByPrimaryKey(updateDto, true);
										}
									} else if (haveAmount.compareTo(totalReceivablesAmount) >= 0) {
										// 当已收款金额大于等于应收款金额时更新按揭收款状态为已付款
										for (MortgageRecord mortgageRecord : mortgageRecords) {
											MortgageRecordDto updateDto = new MortgageRecordDto();
											updateDto.setId(mortgageRecord.getId());
											updateDto.setMortgageReceivedStatus("2");// 已收款
											mortgageRecordServiceFacade.updateByPrimaryKey(updateDto, true);
										}
									}

								}
							}
						}

					}
				}

				return response.isSuccess();
			} catch (Exception e) {
				logger.error(e.toString(), e);
			}
		}
		return false;
	}

	// 删除
	@RequestMapping(value = "delete", method = RequestMethod.POST)
	@ResponseBody
	public AjaxRes delete(Long id) {
		AjaxRes ar = getAjaxRes();
		/*
		 * 1.判断权限2.调用查看接口3.返回信息
		 */
		if (ar.setNoAuth(doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "marketing:haveReceiveRefund:delete"))) {
			try {
				Response<Integer> response = haveReceiveRefundServiceFacade.deleteByPrimaryKey(id);
				if (response.isSuccess()) {
					ar.setSucceedMsg(Const.DEL_SUCCEED);
				} else {
					ar.setFailMsg(Const.DEL_FAIL);
				}
			} catch (Exception e) {
				logger.error(e.toString(), e);
				ar.setFailMsg(Const.DEL_FAIL);
			}
		}
		return ar;
	}
	/**
	 * 
	 * haveReceicerefundExport:(已收款导出). <br/>
	 * @author Administrator
	 * @param request
	 * @param json
	 * @param response
	 * @since JDK 1.6
	 */
	@RequestMapping(value = "haveReceicerefundExport")
	public void haveReceicerefundExport(HttpServletRequest request, String json,HttpServletResponse response) throws Exception{
		AjaxRes ar = getAjaxRes();
		if (ar.setNoAuth(doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON,"fin:haveReceive:list"))) {
			String[] name = null;
			List<String[]> headerList = new ArrayList<String[]>(); 
			List<List<Map<String, String>>> list = new ArrayList<List<Map<String, String>>>(); //数据集合
			String[] header = new String[]{
					"客户名称","房号","签约面积(㎡)","签约单价(元)","签约金额(元)","房款类型","业务标志","发生额","票据号码","结算日期/结算人员/结算方式","结算银行","备注","复核状态","操作日期"
			};
			String jsonStr=URLDecoder.decode(json,"utf-8");
			HaveReceiveRefundInfoDto dto = JSONObject.parseObject(jsonStr, HaveReceiveRefundInfoDto.class);
			if(dto.getDocType().equals(DocTypeEnum.COLLECTION.getNo())){
				name = new String[]{"已收款明细"};
			}else{
				name = new String[]{"已退款明细"};
			}
			headerList.add(header);
			dto = setQueryHaveReceive(dto);
			dto.setIsExport("1");
			Page<HaveReceiveRefundInfo> responseList = haveReceiveRefundServiceFacade.findPageByDtoInfo(dto,PageUtil.begin(0, 10), 10);
			List<Map<String, String>> listMap = needReceicerefundExportService.returnFieldHaveReceiveRefund(responseList.getRows(), header);
			list.add(listMap);
			ExcelUtil.exportExcel(list, headerList, name, response);
		}
	}
	
	// 分页查询
	@RequestMapping(value = "list")
	@ResponseBody
	public Page<HaveReceiveRefundInfo> list(HttpServletRequest request, HaveReceiveRefundInfoDto dto, Integer page, Integer limit) {
		/*
		 * 1.判断权限2.调用分页查询接口3.返回信息
		 */
		String authStr = "fin:haveReceive:list";
		if (doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, authStr/*"fin:needReceive:checkList" 此权限为复核查询功能*/)) {
			try {
				dto.setYsDateStart(request.getParameter("ysDateStart"));
				dto.setYsDateEnd(request.getParameter("ysDateEnd"));
				dto = setQueryHaveReceive(dto);
				Page<HaveReceiveRefundInfo> response = haveReceiveRefundServiceFacade.findPageByDtoInfo(dto,PageUtil.begin(page, limit), limit);
				if (response.getSuccess()) {
					if (null == response.getRows()) {
						response.setRows(new ArrayList<HaveReceiveRefundInfo>());
					}
					response.setPageNumber(page);
					return response;
				}
			} catch (Exception e) {
				logger.error(e.toString(), e);
			}
		}
		return new Page<HaveReceiveRefundInfo>();
	}

	/**
	 *
	 * haveReceicerefundExport:(已收款导出). <br/>
	 * @author Administrator
	 * @param request
	 * @param json
	 * @param response
	 * @since JDK 1.6
	 */
	@RequestMapping(value = "haveAdvanceRefundExport")
	public void haveAdvanceRefundExport(HttpServletRequest request, String json,HttpServletResponse response) throws Exception{
		AjaxRes ar = getAjaxRes();
		if (ar.setNoAuth(doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON,"fin:haveReceive:list"))) {
			String[] name = null;
			List<String[]> headerList = new ArrayList<String[]>();
			List<List<Map<String, String>>> list = new ArrayList<List<Map<String, String>>>(); //数据集合
			String[] header = new String[]{
					"客户名称","房号","签约面积(㎡)","签约单价(元)","签约金额(元)","房款类型","业务标志","发生额","票据号码","结算日期/结算人员/结算方式","结算银行","备注","复核状态","操作日期"
			};
			String jsonStr=URLDecoder.decode(json,"utf-8");
			HaveAdvanceRefundInfoDto dto = JSONObject.parseObject(jsonStr, HaveAdvanceRefundInfoDto.class);
			if(dto.getDocType().equals(DocTypeEnum.COLLECTION.getNo())){
				name = new String[]{"已收垫付首期明细"};
			}else{
				name = new String[]{"已退垫付首期明细"};
			}
			headerList.add(header);
			dto = setQueryHaveAdvance(dto);
			dto.setIsExport("1");
			Page<HaveAdvanceRefundInfo> responseList = haveAdvanceRefundServiceFacade.findPageByDtoInfo(dto,PageUtil.begin(0, 10), 10);
			List<Map<String, String>> listMap = needReceicerefundExportService.returnFieldHaveAdvanceRefund(responseList.getRows(), header);
			list.add(listMap);
			ExcelUtil.exportExcel(list, headerList, name, response);
		}
	}

	// 分页查询
	@RequestMapping(value = "advanceList")
	@ResponseBody
	public Page<HaveAdvanceRefundInfo> advanceList(HttpServletRequest request, HaveAdvanceRefundInfoDto dto, Integer page, Integer limit) {
		/*
		 * 1.判断权限2.调用分页查询接口3.返回信息
		 */
		String authStr = "fin:haveReceive:list";
		if (doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, authStr/*"fin:needReceive:checkList" 此权限为复核查询功能*/)) {
			try {
				dto.setYsDateStart(request.getParameter("ysDateStart"));
				dto.setYsDateEnd(request.getParameter("ysDateEnd"));
				dto = setQueryHaveAdvance(dto);
				Page<HaveAdvanceRefundInfo> response = haveAdvanceRefundServiceFacade.findPageByDtoInfo(dto,PageUtil.begin(page, limit), limit);
				if (response.getSuccess()) {
					if (null == response.getRows()) {
						response.setRows(new ArrayList<HaveAdvanceRefundInfo>());
					}
					response.setPageNumber(page);
					return response;
				}
			} catch (Exception e) {
				logger.error(e.toString(), e);
			}
		}
		return new Page<HaveAdvanceRefundInfo>();
	}

	public HaveAdvanceRefundInfoDto setQueryHaveAdvance(HaveAdvanceRefundInfoDto dto) throws Exception{
		User user = ShiroUtil.getCurrentUser();
		dto.setMerchantId(user.getMerchantId());
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String ysDateStart = dto.getYsDateStart();
		if (StringUtils.isNotBlank(ysDateStart)) {
			ysDateStart += " 00:00:00";
			dto.setStatementDateBefore(sdf.parse(ysDateStart));
		}
		String ysDateEnd = dto.getYsDateEnd();
		if (StringUtils.isNotBlank(ysDateEnd)) {
			ysDateEnd += " 23:59:59";
			dto.setStatementDateAfter(sdf.parse(ysDateEnd));
		}
		dto.setDelFlag("0"); // 未删除
		dto.setPermissionUserId(user.getId());
		dto.setOrders(" t.create_time desc ");
		dto.setPermissionUserId(user.getId());
		return dto;
	}

	public HaveReceiveRefundInfoDto setQueryHaveReceive(HaveReceiveRefundInfoDto dto) throws Exception{
		User user = ShiroUtil.getCurrentUser();
		dto.setMerchantId(user.getMerchantId());
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String ysDateStart = dto.getYsDateStart();
		if (StringUtils.isNotBlank(ysDateStart)) {
			ysDateStart += " 00:00:00";
			dto.setStatementDateBefore(sdf.parse(ysDateStart));
		}
		String ysDateEnd = dto.getYsDateEnd();
		if (StringUtils.isNotBlank(ysDateEnd)) {
			ysDateEnd += " 23:59:59";
			dto.setStatementDateAfter(sdf.parse(ysDateEnd));
		}
		dto.setDelFlag("0"); // 未删除
		dto.setPermissionUserId(user.getId());
		dto.setOrders(" t.create_time desc ");
		dto.setPermissionUserId(user.getId());
		return dto;
	}
	
	// 分页查询
	@RequestMapping(value = "re_checked_list")
	@ResponseBody
	public Page<HaveReceiveRefundInfo> re_checked_list(HaveReceiveRefundInfoDto dto, Integer page, Integer limit,
			String jsDateEnd, String jsDateStart, String needAuth) {
		/*
		 * 1.判断权限2.调用分页查询接口3.返回信息
		 */
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		boolean authFlag = doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "fin:needReceive:checkList");
		if(null != needAuth && "F".equals(needAuth)){
			authFlag = true;
		}
		if (authFlag) {
			try {
				if (!com.alibaba.druid.util.StringUtils.isEmpty(jsDateEnd)) {
					dto.setStatementDateAfter(df.parse(jsDateEnd + " 23:59:59"));
				}

				if (!com.alibaba.druid.util.StringUtils.isEmpty(jsDateStart)) {
					dto.setStatementDateBefore(df.parse(jsDateStart + " 00:00:00"));
				}
				User user = ShiroUtil.getCurrentUser();
				dto.setMerchantId(user.getMerchantId());
				dto.setDelFlag("0"); // 未删除
				dto.setPermissionUserId(user.getId());
				Page<HaveReceiveRefundInfo> response = haveReceiveRefundServiceFacade.findPageByDtoInfo(dto,
						PageUtil.begin(page, limit), limit);
				if (response.getSuccess()) {
					if (null == response.getRows()) {
						response.setRows(new ArrayList<HaveReceiveRefundInfo>());
					} else {
						List<HaveReceiveRefundInfo> list = response.getRows();
						for (int i = 0; i < list.size(); i++) {
							HaveReceiveRefundInfo info = (HaveReceiveRefundInfo) list.get(i);
							if (info.getReceivablesType().equals(BusinessTypeEnum.SIGNED.getNo())) {
								// 查询签约信息
								Response<Signed> resp = signedServiceFacade.findById(info.getRelationId());
								if (resp.isSuccess() && resp.getEntity() != null) {
									info.setCalculatArea(resp.getEntity().getCalculateArea().toString());
									info.setPrice(resp.getEntity().getSignPrice());
									info.setTotalPrice(resp.getEntity().getSignAmount());
								}
							} else if (info.getReceivablesType().equals(BusinessTypeEnum.AREA.getNo())) {
								// 面积补差
								Response<ReserveArea> res = reserveAreaServiceFacade.findById(info.getRelationId());
								if (res.isSuccess() && res.getEntity() != null) {
									// 签约信息
									Response<Signed> resp = signedServiceFacade.findById(res.getEntity().getSignedId());
									if (resp.isSuccess() && resp.getEntity() != null) {
										info.setSignId(resp.getEntity().getId());
										info.setCalculatArea(resp.getEntity().getCalculateArea().toString());
										info.setPrice(resp.getEntity().getSignPrice());
										info.setTotalPrice(resp.getEntity().getSignAmount());
									}
								}
							}
							if (StringUtils.isNotBlank(info.getHousingFundType())) {
								// 房款类型
								info.setRelationType(HousingFundTypeEnum.getByNo(info.getHousingFundType()).getDes());
							}
							if (StringUtils.isNotBlank(info.getBusinessFlag())) {
								// 业务标志
								info.setBusinessType(BusinessFlagEnum.getByNo(info.getBusinessFlag()).getDes());
							}
							// 结算日期 + 结算人员 + 结算方式
							String statement = "";
							if (info.getStatementDate() != null) {
								SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
								statement = sdf.format(info.getStatementDate());
							}
							if (StringUtils.isNotBlank(info.getStatement_name())) {
								statement = statement + "/" + info.getStatement_name();
							}
							if (info.getStatementType() != null) {
								info.setPaymentMethod_name(StatementTypeEnum.getByNo(info.getStatementType() + "")
										.getDes());
								statement = statement + "/"
										+ StatementTypeEnum.getByNo(info.getStatementType() + "").getDes();
							}
							info.setStatement(statement);
							if (info.getCheckUserId() != null) {
								Response<User> res = userServiceFacade.findById(info.getCheckUserId());
								info.setChecked_name(res.getEntity().getUserName());
							}

							// 票据信息，当新票据号不为空时取新票据号
							if (StringUtils.isNotBlank(info.getNewBillCode())) {
								info.setBillCode(info.getNewBillCode());
							}
						}
					}
					response.setPageNumber(page);
					return response;
				}
			} catch (Exception e) {
				logger.error(e.toString(), e);
			}
		}
		return new Page<HaveReceiveRefundInfo>();
	}

	// 退款页面列表
	@RequestMapping(value = "refund_list_view")
	@ResponseBody
	public Page<HaveReceiveRefundInfo> refund_list_view(HttpServletRequest request, long id, Integer page, Integer limit) {
		/*
		 * 1.判断权限2.调用分页查询接口3.返回信息
		 */
		if (doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "fin:haveReceive:refund")) {
			try {
				String needOrHave = request.getParameter("needOrHave");
				if ("have".equals(needOrHave)) {
					HaveReceiveRefundInfoDto dto = new HaveReceiveRefundInfoDto();
					dto.setDelFlag("0"); // 未删除
					dto.setId(id);
					Page<HaveReceiveRefundInfo> have = haveReceiveRefundServiceFacade.findPageByDtoInfo(dto,
							PageUtil.begin(page, limit), limit);
					if (have.getSuccess() && null != have.getRows()) {
						List<HaveReceiveRefundInfo> list = have.getRows();
						for (int i = 0; i < list.size(); i++) {
							HaveReceiveRefundInfo info = (HaveReceiveRefundInfo) list.get(i);
							// 房款类型
							if (StringUtils.isNotBlank(info.getHousingFundType())) {
								info.setRelationType(HousingFundTypeEnum.getByNo(info.getHousingFundType()).getDes());
							}
							// 业务标志
							if (StringUtils.isNotBlank(info.getBusinessFlag())) {
								info.setBusinessType(BusinessFlagEnum.getByNo(info.getBusinessFlag()).getDes());
							}
							// 票据信息，当新票据号不为空时取新票据号
							if (StringUtils.isNotBlank(info.getNewBillCode())) {
								info.setBillCode(info.getNewBillCode());
							}
							// 结算方式
							if (StringUtils.isNotBlank(info.getPaymentMethod())) {
								info.setPaymentMethod_name(PaymentMethodEnum.getByNo(info.getPaymentMethod()).getDes());
							}
						}
					} else {
						have.setRows(new ArrayList<HaveReceiveRefundInfo>());
					}
					have.setPageNumber(page);
					return have;
				} else {
					Page<HaveReceiveRefundInfo> pageModel = new Page<HaveReceiveRefundInfo>();
					List<HaveReceiveRefundInfo> listModel = new ArrayList<HaveReceiveRefundInfo>();
					NeedReceiveRefundInfoDto dto = new NeedReceiveRefundInfoDto();
					dto.setDelFlag("0"); // 未删除
					dto.setId(id);
					Page<NeedReceiveRefundInfo> need = needReceiveRefundServiceFacade.findPageByDtoInfo(dto,
							PageUtil.begin(page, limit), limit);
					if (need.getSuccess() && need.getRows() != null) {
						List<NeedReceiveRefundInfo> list = need.getRows();
						for (int i = 0; i < list.size(); i++) {
							NeedReceiveRefundInfo info = (NeedReceiveRefundInfo) list.get(i);

							HaveReceiveRefundInfo entity = new HaveReceiveRefundInfo();
							BeanUtils.copyProperties(info, entity);
							entity.setReceivablesType(info.getBusinessType()); // 业务类型
							entity.setReceivablesId(info.getRelationId()); // 业务ID
							// 房款类型
							if (StringUtils.isNotBlank(info.getHousingFundType())) {
								entity.setRelationType(HousingFundTypeEnum.getByNo(info.getHousingFundType()).getDes());
							}
							// 业务标志
							if (StringUtils.isNotBlank(info.getBusinessFlag())) {
								entity.setBusinessType(BusinessFlagEnum.getByNo(info.getBusinessFlag()).getDes());
							}
							entity.setRealAmount(info.getTotalReceivablesAmount());
							listModel.add(entity);
						}

					}
					pageModel.setRows(listModel);
					pageModel.setTotal(need.getTotal());
					pageModel.setTotalPages(need.getTotalPages());
					pageModel.setPageNumber(page);
					return pageModel;
				}

			} catch (Exception e) {
				logger.error(e.toString(), e);
			}
		}
		return new Page<HaveReceiveRefundInfo>();
	}

	/**
	 * 垫付首期退款页面列表
 	 */
	@RequestMapping(value = "advanceRefundList")
	@ResponseBody
	public Page<HaveAdvanceRefundInfo> advanceRefundList(HttpServletRequest request, long id, Integer page, Integer limit) {
		/*
		 * 1.判断权限2.调用分页查询接口3.返回信息
		 */
		if (doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "fin:haveReceive:refund")) {
			try {
				String needOrHave = request.getParameter("needOrHave");
				if ("have".equals(needOrHave)) {
					HaveAdvanceRefundInfoDto dto = new HaveAdvanceRefundInfoDto();
					dto.setDelFlag("0"); // 未删除
					dto.setId(id);
					Page<HaveAdvanceRefundInfo> have = haveAdvanceRefundServiceFacade.findPageByDtoInfo(dto,
							PageUtil.begin(page, limit), limit);
					if (have.getSuccess() && null != have.getRows()) {
						List<HaveAdvanceRefundInfo> list = have.getRows();
						for (int i = 0; i < list.size(); i++) {
							HaveAdvanceRefundInfo info = list.get(i);
							// 房款类型
							if (StringUtils.isNotBlank(info.getHousingFundType())) {
								info.setRelationType(HousingFundTypeEnum.getByNo(info.getHousingFundType()).getDes());
							}
							// 业务标志
							if (StringUtils.isNotBlank(info.getBusinessFlag())) {
								info.setBusinessType(BusinessFlagEnum.getByNo(info.getBusinessFlag()).getDes());
							}
							// 票据信息，当新票据号不为空时取新票据号
							if (StringUtils.isNotBlank(info.getNewBillCode())) {
								info.setBillCode(info.getNewBillCode());
							}
							// 结算方式
							if (StringUtils.isNotBlank(info.getPaymentMethod())) {
								info.setPaymentMethod_name(PaymentMethodEnum.getByNo(info.getPaymentMethod()).getDes());
							}
						}
					} else {
						have.setRows(new ArrayList<HaveAdvanceRefundInfo>());
					}
					have.setPageNumber(page);
					return have;
				} else {
					Page<HaveAdvanceRefundInfo> pageModel = new Page<>();
					List<HaveAdvanceRefundInfo> listModel = new ArrayList<>();
					NeedAdvanceRefundInfoDto dto = new NeedAdvanceRefundInfoDto();
					dto.setDelFlag("0"); // 未删除
					dto.setId(id);
					Page<NeedAdvanceRefundInfo> need = needAdvanceRefundServiceFacade.findPageByDtoInfo(dto,
							PageUtil.begin(page, limit), limit);
					if (need.getSuccess() && need.getRows() != null) {
						List<NeedAdvanceRefundInfo> list = need.getRows();
						for (int i = 0; i < list.size(); i++) {
							NeedAdvanceRefundInfo info = list.get(i);

							HaveAdvanceRefundInfo entity = new HaveAdvanceRefundInfo();
							BeanUtils.copyProperties(info, entity);
							entity.setReceivablesType(info.getBusinessType()); // 业务类型
							entity.setReceivablesId(info.getRelationId()); // 业务ID
							// 房款类型
							if (StringUtils.isNotBlank(info.getHousingFundType())) {
								entity.setRelationType(HousingFundTypeEnum.getByNo(info.getHousingFundType()).getDes());
							}
							// 业务标志
							if (StringUtils.isNotBlank(info.getBusinessFlag())) {
								entity.setBusinessType(BusinessFlagEnum.getByNo(info.getBusinessFlag()).getDes());
							}
							entity.setRealAmount(info.getTotalReceivablesAmount());
							listModel.add(entity);
						}

					}
					pageModel.setRows(listModel);
					pageModel.setTotal(need.getTotal());
					pageModel.setTotalPages(need.getTotalPages());
					pageModel.setPageNumber(page);
					return pageModel;
				}

			} catch (Exception e) {
				logger.error(e.toString(), e);
			}
		}
		return new Page<HaveAdvanceRefundInfo>();
	}

	// 查询公司员工
	@RequestMapping(value = "findUserByMerID")
	@ResponseBody
	public List<User> findUserByDeptId(String type) {
		try {
			Long roleId = null;
			if (!com.alibaba.druid.util.StringUtils.isEmpty(type)) {
				RoleDto roleDto = new RoleDto();
				roleDto.setRoleName("经纪人");
				Role role = roleServiceFacade.findByDto(roleDto).getEntity().get(0);
				roleId = role.getId();
			}
			User user = ShiroUtil.getCurrentUser();
			UserDto dto = new UserDto();
			dto.setMerchantId(user.getMerchantId());
			dto.setRoleId(roleId);
			dto.setUserStatus("0");
			dto.setIsAdmin("0");
			ResponseList<User> responseList = userServiceFacade.findByDto(dto);
			if (responseList.isSuccess() && null != responseList.getEntity()) {
				return responseList.getEntity();
			}
		} catch (Exception e) {
			logger.error(e.toString(), e);
		}
		return new ArrayList<User>();
	}

	// 查询公司客户
	@RequestMapping(value = "findCustomer")
	@ResponseBody
	public List<Customer> findCustomer() {
		try {
			User user = ShiroUtil.getCurrentUser();
			CustomerDto dto = new CustomerDto();
			dto.setMerchantId(user.getMerchantId());
			ResponseList<Customer> responseList = customerServiceFacade.findByDto(dto);
			if (responseList.isSuccess() && null != responseList.getEntity()) {
				return responseList.getEntity();
			}
		} catch (Exception e) {
			logger.error(e.toString(), e);
		}
		return new ArrayList<Customer>();
	}

	// 查询房间list
	@RequestMapping(value = "findRoomId")
	@ResponseBody
	public List<ProjectRoom> findRoomId() {
		try {
			User user = ShiroUtil.getCurrentUser();
			ProjectRoomDto dto = new ProjectRoomDto();
			dto.setMerchantId(user.getMerchantId());
			ResponseList<ProjectRoom> responseList = projectRoomServiceFacade.findByDto(dto);
			if (responseList.isSuccess() && null != responseList.getEntity()) {
				return responseList.getEntity();
			}
		} catch (Exception e) {
			logger.error(e.toString(), e);
		}
		return new ArrayList<ProjectRoom>();
	}

	// 结算方式枚举
	@RequestMapping(value = "statementTypeEnum")
	@ResponseBody
	public List<value> statementTypeEnum() {
		List<value> list = new ArrayList<value>();
		try {
			HaveReceiveRefundController h = new HaveReceiveRefundController();
			StatementTypeEnum[] types = StatementTypeEnum.values();
			for (int i = 0; i < types.length; i++) {
				value type = h.new value();
				type.setId(types[i].getNo());
				type.setValue(types[i].getDes());
				list.add(type);
			}
		} catch (Exception e) {
			logger.error(e.toString(), e);
		}
		return list;
	}

	// 业务类型枚举
	@RequestMapping(value = "businessFlagEnum")
	@ResponseBody
	public List<value> businessFlagEnum() {
		List<value> list = new ArrayList<value>();
		try {
			User user = ShiroUtil.getCurrentUser();
			// 认筹开关,默认未关闭(false) ,true已关闭
			boolean payDepositOff = false;
			Response<Boolean> response = merchantServiceFacade.merPayDepositOff(user.getMerchantId());
			if (response.isSuccess()) {
				payDepositOff = response.getEntity();
			}
			HaveReceiveRefundController h = new HaveReceiveRefundController();
			BusinessFlagEnum[] types = BusinessFlagEnum.values();
			for (int i = 0; i < types.length; i++) {
				if (payDepositOff && types[i].getDes().contains("认筹")) {
					continue;
				}
				value type = h.new value();
				type.setId(types[i].getNo());
				type.setValue(types[i].getDes());
				list.add(type);
			}
		} catch (Exception e) {
			logger.error(e.toString(), e);
		}
		return list;
	}

	@RequestMapping(value = "toPrint")
	public ModelAndView toPrint(Long id, String printFlag) {
		ModelAndView mv = new ModelAndView();

		HaveReceiveRefund haveReceiveRefund = new HaveReceiveRefund();
		if(!"2".equals(printFlag)) {
			Response<HaveReceiveRefund> refundResponse = haveReceiveRefundServiceFacade.findById(id);
			haveReceiveRefund = refundResponse.getEntity();
		}else{
			Response<HaveAdvanceRefund> advanceRefundResponse = haveAdvanceRefundServiceFacade.findById(id);
			HaveAdvanceRefund haveAdvanceRefund = advanceRefundResponse.getEntity();
			BeanUtils.copyProperties(haveAdvanceRefund, haveReceiveRefund);
		}
		boolean businessFlag = BusinessFlagEnum.getByNo(haveReceiveRefund.getBusinessFlag()).getDes().contains("转入");
		if("1".equals(printFlag)) {
			mv.addObject("backgroundPhoto","receiptRefundPhoto");
			mv.setViewName("/marketing/haveReceiveRefund/receiptTransferPrint");
		}else if(!businessFlag) {
			mv.setViewName("/marketing/haveReceiveRefund/receiptPrint");
		}else{
			mv.addObject("backgroundPhoto","receiptTransferPhoto");
			mv.setViewName("/marketing/haveReceiveRefund/receiptTransferPrint");
		}

		mv.addObject("realAmount",haveReceiveRefund.getRealAmount());
		mv.addObject("realAmountCN", NumberToCN.number2CNMontrayUnit(haveReceiveRefund.getRealAmount()));
		mv.addObject("statementDate", DateUtils.DateToString(haveReceiveRefund.getStatementDate(), DateUtils.parsePatterns[1]));

		FamilyMemberDto familyMemberDto = new FamilyMemberDto();
		String memberType = "";
		switch (haveReceiveRefund.getReceivablesType()){
			case "0" :
				memberType = MemberTypeEnum.DEPOSIT.getNo();
				break;
			case "1" :
				memberType = MemberTypeEnum.SUBSCRIBE.getNo();
				break;
			case "2" :
				memberType = MemberTypeEnum.SIGNED.getNo();
				break;
			case "3" :
				memberType = MemberTypeEnum.SIGNED.getNo();
				break;
		}
		familyMemberDto.setMemberType(memberType);
		familyMemberDto.setBuyId(haveReceiveRefund.getRelationId());
		ResponseList<FamilyMember> memberResponseList = familyMemberServiceFacade.findByDto(familyMemberDto);
		Response<Customer> customerResponse = customerServiceFacade.findById(haveReceiveRefund.getCustomerId());

		StringBuffer customerName = new StringBuffer(customerResponse.getEntity().getCustomerName()+";");
		StringBuffer documentNumber = new StringBuffer(customerResponse.getEntity().getPeDocumentNumber()+";");
		if(memberResponseList.getEntity()!=null && memberResponseList.getEntity().size()>0){
			List<FamilyMember> familyMemberList = memberResponseList.getEntity();
			for(FamilyMember familyMember : familyMemberList){
				customerName.append(familyMember.getMemberName()).append(";");
				documentNumber.append(familyMember.getDocumentNumber()).append(";");
			}
		}
		customerName.deleteCharAt(customerName.length()-1);
		documentNumber.deleteCharAt(documentNumber.length()-1);
		mv.addObject("customerName",customerName.toString());
		mv.addObject("documentNumber",documentNumber.toString());

		Response<ProjectRoom> roomResponse = projectRoomServiceFacade.findById(haveReceiveRefund.getRoomId());
		String[] combinedName = roomResponse.getEntity().getCombinedName().split("-->");
		StringBuffer roomName = new StringBuffer();
		for (int i=0; i<combinedName.length; i++) {
			if(StringUtils.isNotBlank(combinedName[i])){
				roomName.append(combinedName[i]).append("-");
			}
		}
		roomName.deleteCharAt(roomName.length()-1);
		mv.addObject("roomName1",roomName.length()>17?roomName.substring(0,17):roomName);
		mv.addObject("roomName2",roomName.length()>17?roomName.substring(17):"");

		mv.addObject("housingFundType",HousingFundTypeEnum.getByNo(haveReceiveRefund.getHousingFundType()).getDes());
		if(haveReceiveRefund.getStatementType()!=null) {
			mv.addObject("statementType", StatementTypeEnum.getByNo(haveReceiveRefund.getStatementType()+"").getDes());
		}
		if(StringUtils.isNotBlank(haveReceiveRefund.getBankCode())) {
			mv.addObject("bankName", BankNameEnum.getByNo(haveReceiveRefund.getBankCode()).getDes());
		}
		UserDto userDto = new UserDto();
		userDto.setUserCode(haveReceiveRefund.getUserCode());
		ResponseList<User> userResponseList = userServiceFacade.findByDto(userDto);
		if(userResponseList.getEntity()!=null){
			mv.addObject("userName",userResponseList.getEntity().get(0).getUserName());
		}

		if(StringUtils.isBlank(haveReceiveRefund.getBillType()) || "1".equals(haveReceiveRefund.getBillType())) {
			StringBuffer billCode = new StringBuffer("ZZJXY");
			ProjectPmoDto projectPmoDto = new ProjectPmoDto();
			projectPmoDto.setProjectId(roomResponse.getEntity().getProjectId());
			ResponseList<ProjectPmo> projectPmoResponseList = projectPmoServiceFacade.findByDto(projectPmoDto);
			billCode.append(projectPmoResponseList.getEntity().get(0).getPromotName());
			billCode.append(StringUtils.leftPad(haveReceiveRefund.getId()+"", 7, "0"));
			mv.addObject("billCode",billCode);
		}else {
			mv.addObject("billCode",haveReceiveRefund.getBillCode());
		}

		return mv;
	}


	@RequestMapping(value="toHaveReceiveRefundInfoList")
	public String toHaveReceiveRefundInfoList(ModelMap map){
		map.put("permitBtn", doSecurityIntercept(Const.RESOURCES_TYPE_BUTTON, "haveReceiveRefund:list:all"));
		ProjectPremisesDto premisesDto = new ProjectPremisesDto();
		premisesDto.setProjectId(153l);
		ResponseList<ProjectPremises> dataList = projectPremisesServiceFacade.findByDto(premisesDto);
		map.put("premisesList",dataList.getEntity());
		return "/marketing/haveReceiveRefund/haveReceiveRefundInfoList";
	}


	/**
	 * 查询回款信息
	 * @param request
	 * @return
	 */
	@RequestMapping(value="haveReceiveRefundInfoList", method=RequestMethod.POST)
	@ResponseBody
	public AjaxRes haveReceiveRefundInfoList(HttpServletRequest request, Integer pageSize,Integer pageNum){
		AjaxRes ar=getAjaxRes();
		try {
			//获取用户
			User user = ShiroUtil.getCurrentUser();
			if(user == null){
				ar.setFailMsg(Const.SAVE_FAIL);
				return ar;
			}
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			SimpleDateFormat sdfEX = new SimpleDateFormat("yyyy-MM-dd");
			String premisesId = request.getParameter("premisesId");
			String strTime =   request.getParameter("strTime");
			String endTime =   request.getParameter("endTime");

			HaveReceiveRefundInfo dto = new HaveReceiveRefundInfo();
			dto.setPremisesId(premisesId);
			if (strTime != "" && strTime != null){
				dto.setStrTime(sdf.parse(strTime+" 00:00:00"));
			}
			if (endTime != "" && endTime != null){
				dto.setEndTime(sdf.parse(endTime+" 23:59:59"));
			}
			Page<HaveReceiveRefundInfo> page = haveReceiveRefundServiceFacade.findHaveReceivePageInfoByDto(dto,PageUtil.begin(pageNum, pageSize), pageSize);
			if(page.getSuccess()){
				if(null==page.getRows()) {
					page.setRows(new ArrayList<HaveReceiveRefundInfo>());
				}else{
					for(HaveReceiveRefundInfo c : page.getRows()){
						String signDate = "";
						String didTime = "";
						String signDidTime = "";
						if(c.getSignDate() != null){
							signDate = sdfEX.format(c.getSignDate());
							c.setSignDateStr(signDate);
						}else{
							c.setSignDateStr(signDate);
						}
						if (c.getCreateTime() != null){
							didTime = sdfEX.format(c.getCreateTime());
							c.setCreateTimeStr(didTime);
						}else{
							c.setCreateTimeStr(didTime);
						}
						if (c.getSignDidTime() != null){
							signDidTime = sdfEX.format(c.getSignDidTime());
							c.setSignDidTimeStr(signDidTime);
						}else{
							c.setSignDidTimeStr(signDidTime);
						}
						if ( c.getHousingFundType().equals("7")  || c.getHousingFundType().equals("11") || c.getHousingFundType().equals("19") || c.getHousingFundType().equals("18") || c.getHousingFundType().equals("36") || c.getHousingFundType().equals("37")){
							c.setHousingFundType("贷款类");
						}else{
							c.setHousingFundType("非贷款类");
						}
						if(c.getPaymentMethod() != null){
							// 付款方式
							StatementTypeEnum paymentMethodEnum = StatementTypeEnum.getByNo(c.getPaymentMethod());
							c.setPaymentMethod(paymentMethodEnum.getDes());
						}else{
							c.setPaymentMethod("");
						}

						if(c.getRealAmount() == null){
							c.setRealAmount(new BigDecimal(0.00));
						}
						if(c.getRealAmount() != null && c.getDocType().equals("1")){
							c.setRealAmount(c.getRealAmount().negate());
						}

						if(c.getBillType()!= null && c.getBillType().equals("1")){
							c.setBillType("电子票据");
						}
						if( c.getBillType()!= null && c.getBillType().equals("2")){
							c.setBillType("纸质票据");
						}
						if(c.getBillType() == null ){
							c.setBillType("");
						}
						if(c.getRoomStatus() != null){
							c.setRoomStatus(RoomStatusEnum.getByNo(c.getRoomStatus()).getDes());
						}else{
							c.setRoomStatus("");
						}
						if(c.getSubscribeDate()!= null){
							c.setSubscribeDateStr(sdfEX.format(c.getSubscribeDate()));
						}else{
							c.setSubscribeDateStr("");
						}
						if(c.getPayerName() == null){
							c.setPayerName("");
						}
						if(c.getReceivablesFunds() == null){
							c.setReceivablesFunds("");
						}
						if(c.getBillCode() == null){
							c.setBillCode("");
						}
						if(c.getPremisesSecName() == null){
							c.setPremisesSecName("");
						}
					}
				}

			}else{
				ar.setFailMsg(Const.DATA_FAIL);
			}
			page.setPageNumber(pageNum);
			ar.setSucceed(page);
		} catch (Exception e) {
			logger.error(e.toString(),e);
			ar.setFailMsg(Const.DATA_FAIL);
		}
		return ar;
	}

	/**
	 * 导出认购明细列表
	 * @param request
	 * @return
	 */
	@RequestMapping("exportHaveReceiveRefundInfoList")
	@ResponseBody
	public AjaxRes exportHaveReceiveRefundInfoList(HttpServletRequest request, HttpServletResponse response, Model model) {
		AjaxRes ar=getAjaxRes();
		try {
			//获取用户
			SimpleDateFormat sdfEX = new SimpleDateFormat("yyyy-MM-dd");
			User user = ShiroUtil.getCurrentUser();
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			String premisesId = request.getParameter("premisesId");
			String strTime =   request.getParameter("strTime");
			String endTime =   request.getParameter("endTime");

			HaveReceiveRefundInfo dto = new HaveReceiveRefundInfo();
			dto.setPremisesId(premisesId);
			if (strTime != "" && strTime != null){
				dto.setStrTime(sdf.parse(strTime+" 00:00:00"));
			}
			if (endTime != "" && endTime != null){
				dto.setEndTime(sdf.parse(endTime+" 23:59:59"));
			}
			ResponseList<HaveReceiveRefundInfo> resultList = haveReceiveRefundServiceFacade.findHaveReceiveInfoByDto(dto);
			//设置excel sheet
			String[] name = {"回款信息列表"};
			//设置excel 列表表头
			List<String[]> headerList = new ArrayList<String[]>();
			String[] header = {
					"项目名称", "项目", "交款日期", "交易客户姓名","交款人","房间全程","业态",
					"款项类型","款项名称","金额","单据类型","票据类型","票据编号","支付方式","房间状态","备注","认购日期",
					"签约时间","合同签约日期"
			};
			headerList.add(header);


			List<String[]> headerNumList = new ArrayList<String[]>();
			String[] headerNum = new String[]{
					"金额"
			};
			headerNumList.add(headerNum);
			//组装数据
			List<List<Map<String, String>>> list = new ArrayList<List<Map<String, String>>>(); //数据集合
			List<Map<String, String>> listMap = buildtHaveReceiveRefundInfoList(resultList.getEntity(), header);
			list.add(listMap);
			ExcelUtil.exportExcelForNumber(list, headerList,headerNumList, name, response);
			ar.setSucceedMsg(Const.SAVE_SUCCEED);
		} catch (Exception e) {
			logger.error("导出逾期未签约列表失败", e);
			ar.setFailMsg(Const.DATA_FAIL);
		}
		return ar;
	}


	/**
	 * 组装导出逾期未签约数据
	 */
	private List<Map<String, String>> buildtHaveReceiveRefundInfoList(List<HaveReceiveRefundInfo> list, String[] head) {
		List<Map<String, String>> listMap = new ArrayList<Map<String,String>>();
		try {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			for (int i=0;i<list.size();i++) {
				HaveReceiveRefundInfo data = list.get(i);
				Map<String, String> map = new HashMap<String, String>();
				map.put(head[0]+"_"+i,data.getProjectName()); //项目名称

				map.put(head[1]+"_"+i, data.getProjectName()+"-"+data.getPremisesSecName()); //项目
				map.put(head[2]+"_"+i, sdf.format(data.getCreateTime())); //客户状态
				map.put(head[3]+"_"+i, data.getCustomerName());
				map.put(head[4]+"_"+i, data.getPayerName());
				map.put(head[5]+"_"+i,data.getCombinedName());
				map.put(head[6]+"_"+i, data.getCodeName());


				if ( data.getHousingFundType().equals("7")  || data.getHousingFundType().equals("11") || data.getHousingFundType().equals("19") || data.getHousingFundType().equals("18") || data.getHousingFundType().equals("36") || data.getHousingFundType().equals("37")){
					map.put(head[7]+"_"+i,"贷款类");
				}else{
					map.put(head[7]+"_"+i,"非贷款类");
				}
				/*if(data.getHousingFundType() != null){

				}else{
					map.put(head[7]+"_"+i,"");
				}*/

				map.put(head[8]+"_"+i, data.getReceivablesFunds());
				if(data.getRealAmount() != null){
					map.put(head[9]+"_"+i,data.getRealAmount().toString());
				}else{
					map.put(head[9]+"_"+i,"");
				}
				if(data.getRealAmount() != null && data.getDocType().equals("1")){
					map.put(head[9]+"_"+i,"-"+data.getRealAmount().toString());
				}
				map.put(head[10]+"_"+i,data.getDocTypeName());
				if(data.getBillType()!= null && data.getBillType().equals("1")){
					map.put(head[11]+"_"+i,"电子票据");
				}else if( data.getBillType()!= null && data.getBillType().equals("2")){
					map.put(head[11]+"_"+i,"纸质票据");
				}else{
					map.put(head[11]+"_"+i,"");
				}
				map.put(head[12]+"_"+i, data.getBillCode());

				if(data.getPaymentMethod() != null  && data.getPaymentMethod() !=""){
					map.put(head[13]+"_"+i, StatementTypeEnum.getByNo(data.getPaymentMethod()).getDes());
				}else{
					map.put(head[13]+"_"+i, "");
				}


				if(data.getRoomStatus() != null  && data.getRoomStatus() !=""){
					map.put(head[14]+"_"+i, RoomStatusEnum.getByNo(data.getRoomStatus()).getDes());
				}else{
					map.put(head[14]+"_"+i, "");
				}
				map.put(head[15]+"_"+i, data.getRemark());

				if(data.getSubscribeDate() != null){
					map.put(head[16]+"_"+i,sdf.format(data.getSubscribeDate()));
				}else{
					map.put(head[16]+"_"+i,"");
				}

				if(data.getSignDidTime() != null){
					map.put(head[17]+"_"+i,sdf.format(data.getSignDidTime()));
				}else{
					map.put(head[17]+"_"+i,"");
				}

				if(data.getSignDate() != null){
					map.put(head[18]+"_"+i, sdf.format(data.getSignDate()));
				}else{
					map.put(head[18]+"_"+i,"");
				}
				listMap.add(map);
			}
		} catch (Exception e) {
			logger.error("组装导出回款信息提醒数据错误：{}",e);
		}
		return listMap;
	}










	class value {
		private String id;
		private String value;

		public String getId() {
			return id;
		}

		public void setId(String id) {
			this.id = id;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}
	}

	public static void main(String[] args) {
		double i = Math.pow(2, 240);
		System.out.println(new BigDecimal(i));
	}

	// 更新客户信息
	@RequestMapping(value = "updateHaveReceiveCustomerInfo")
	@ResponseBody
	public List<value> updateHaveReceiveCustomerInfo() {
		List<value> list = new ArrayList<value>();
		try {
			haveReceiveRefundServiceFacade.updateHaveReceiveCustomerInfo();
		} catch (Exception e) {
			logger.error(e.toString(), e);
		}
		return list;
	}
}
